# ~*~ coding: utf-8 ~*~
# auth: haochenxiao

import sys
import requests
import time
import hashlib

name = sys.argv[1]
autostatus = sys.argv[2]

ctime = time.time()

#key是在系统管理里面定义的API
key = 'dsfsdfeieirw98-0-_fdsfsdfsdfdfdfsdf'
api_url = 'http://10.16.5.155:12000/alert/api_operation/'
new_key = "%s|%s" % (key, ctime)
m = hashlib.md5()
m.update(bytes(new_key, encoding='utf-8'))
md5_key = m.hexdigest()
md5_key_key = "%s|%s" % (md5_key, ctime)
data = {'name':name,'auto_status':autostatus}
response = requests.post(api_url, headers={'OpenKey':md5_key_key},data = data)
print(response.text)
